<#include "/layout/header.ftl" />
<#import "/include/ui.ftl" as blue />

<script src="${rc_path}/js/jquery/jquery-treetable.js"></script>
<script>

$(function()
{
	$("#tbl_tree").treetable({expandable : true, expanderTemplate : "<a>&nbsp;</a>"});
	
});

function search_click()
{
	var obj = $.getObject("#div_search");	
	$("#div_grid").simpleLoad("/base/open/url_list", obj, 0);
	
}




</script>
<div class="am-g am-cf am-margin-top am-margin-bottom">
	<div class="am-u-sm-3 am-padding-right-0">
		<div class="am-btn-group">
			<a href="${path}/base/open/url_get" class="am-btn am-btn-primary am-radius">添加</a>
		</div>
		<div class="am-u-sm-9 am-form-inline" id="div_search">
		</div>
	</div>
</div>
<div class="am-g" id="div_grid">
	<div class="am-u-sm-12">
		<table class="am-table am-table-striped am-table-hover" id="tbl_tree">
			<thead>
			<tr>
				<th width="250">名称</th>
				<th width="300">链接</th>
				<th>描述</th>
				<th width="100">状态</th>
				<th width="250">操作</th>
			</tr>
			</thead>
			<tbody>
			<#if treeList?? && treeList?size &gt; 0>
			<@tree map=treeList key="0" />
			</#if>
			</tbody>
		</table>
	</div>
</div>
<#macro tree map key count=0>
	<#assign voList=map[key]! />
	
	<#if voList??>
	<#list voList as vo>
			<tr data-tt-id="${vo.id}" data-tt-parent-id="${vo.parentId!}">
				<td title="${vo.name!}">${vo.name!}</td>
				<td title="${vo.url!}">${vo.url!}</td>
				<td width="${vo.descp!}">${vo.descp!}</td>
				<td>${vo.state!}</td>
				<td>
					<div class="am-btn-group">
						<a href="${path}/base/open/url_get?id=${vo.id}" class="am-btn am-btn-primary am-btn-sm am-radius">编辑</a>
						<a href="${path}/base/open/url_get?parentId=${vo.id}" class="am-btn am-btn-danger am-btn-sm am-radius">子链接</a>
					</div>
				</td>
			</tr>
			<@tree map=map key=vo.id?string count=count+1 />
	</#list>
	</#if>
	
</#macro>

<#include "/layout/footer.ftl" />